<?php

namespace App\Admin\Actions\UserAction;

use Encore\Admin\Actions\RowAction;
use Illuminate\Database\Eloquent\Model;

class WechatBindDismiss extends RowAction
{
    public $name = '微信绑定解除';
    
    public function handle(Model $model)
    {
    	$model->update([
    		'wm_openid' => null,
		    'wm_session_key' => null,
		    'wx_openid' => null,
		    'wx_unionid' => null,
		    'wx_nickname' => null,
		    'wx_headimgurl' => null,
		    'wx_sex' => null,
		    'wx_country' => null,
		    'wx_province' => null,
		    'wx_city' => null,
	    ]);
    	
	    return $this->response()->success('微信解绑成功')->refresh();
    }
	
	public function dialog()
	{
		$this->confirm('确定解除当前用户的微信绑定?');
	}
}
